<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script type="text/javascript">
    var proxy = {
      ids: [],
      delay: 50,
      timeout: null,
      callback: null,
      context: null,
      makeRequest: function(id, callback, context) {
        // 加入队列
        this.ids.push(id);

        this.callback = callback;
        this.context = context;

        if (!this.timeout) {
          this.timeout = setTimeout(() => proxy.plush(), this.delay);
        }
      },

      plush: function() {
        http.makeRequest(this.ids, "proxy.handler");

        this.timeout = null;
        this.ids = [];
      },

      handle: function(data) {
        console.log(data);
      }
    }
  </script>
</body>
</html>